package com.xyy.saas.payment.dao.model;

import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

/**
 * @author liujf
 */
@Getter
@Setter
public abstract class AbstractPageParam implements Serializable {
    private Integer page;
    private Integer pageSize;
    private Integer offset;

    public void calcOffset() {
        if (this.page == null || this.page < 1) {
            this.page = 1;
        }

        if (this.pageSize == null || this.pageSize < 1) {
            this.pageSize = 10;
        }

        this.offset = (this.page - 1) * this.pageSize;
    }
}
